<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<script>
    name = 'seven'; // 全局变量
    function func(){
        var age = 18; // 局部变量
        gender = "男" // 全局变量
    }
    console.log(name)
    // console.log(age) 
    console.log(gender)  //报错：未定义
</script>
</body>
</html>